package com.magicalcoder.pigeontest.spring.adminuser.impl;


import com.magicalcoder.pigeontest.model.AdminUser;
import com.magicalcoder.pigeontest.service.AdminUserService;
import com.magicalcoder.pigeontest.service.AdminUserTxService;
import com.magicalcoder.pigeontest.spring.mapper.AdminUserMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Service("adminUserService")
public class AdminUserServiceImpl implements AdminUserService {

    @Resource
    private AdminUserMapper adminUserMapper;
    @Resource
    private AdminUserTxService adminUserTxService;

    @Override
    public List<AdminUser> fetchList() {
        return adminUserMapper.getAdminUserList();
    }

    @Transactional(propagation = Propagation.REQUIRED)
    @Override
    public void txTest() {
        adminUserTxService.requiresNew();
        adminUserTxService.insert("hedy",0L);
//        adminUserTxService.never();
//        adminUserTxService.required();
//        adminUserTxService.supports();
//        adminUserTxService.mandatory();
    }

}
